package com.rzx.mybackend.consumer;

import com.rzx.mybackend.entity.GameComment;
import com.rzx.mybackend.mapper.CommentMapper;
import lombok.RequiredArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * CommentConsumer
 *
 * @author renzhexian
 * @date 2025/7/23
 */
@Component
@RequiredArgsConstructor
public class CommentConsumer {

    private static final Logger log = LoggerFactory.getLogger(CommentConsumer.class);

    private final CommentMapper commentMapper;

    @RabbitListener(queues = "${spring.rabbitmq.comment.queue_name}")
    public void getComment(GameComment gameComment) {

        log.info("接收到评论消息：" + gameComment);

        commentMapper.putComment(gameComment);

    }
}
